package com.longteng.diamond.factory;

import com.longteng.diamond.service.MockMatchDataService;
import com.longteng.diamond.service.impl.CustomMatchImpl;
import com.longteng.diamond.service.impl.JsonPathMatchImpl;
import com.longteng.diamond.service.impl.KeyValueMatchImpl;
import com.longteng.diamond.service.impl.XPathMatchImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator
 * DATE : 2018/8/12
 * TIME : 9:40
 * PROJECT : java-lesson
 * PACKAGE : com.longteng.lesson
 *
 * @author <a href="mailto:taki@qq.com">Administrator</a>
 */
@Component
public class MockMatchDataFactory {

    @Autowired
    KeyValueMatchImpl keyValueMatch;
    @Autowired
    JsonPathMatchImpl jsonPathMatch;
    @Autowired
    XPathMatchImpl xPathMatch;
    @Autowired
    CustomMatchImpl customMatch;
    public MockMatchDataService getMatchService(String matchType){
        MockMatchDataService matchDataService=null;
        switch (matchType){
            case "keyValue":
                matchDataService=keyValueMatch;
                break;
            case "jsonPath":
                matchDataService=jsonPathMatch;
                break;
            case "xPath":
                matchDataService=xPathMatch;
                break;
            case "custom":
                matchDataService=customMatch;
                break;
            default:
        }
        return matchDataService;
    }
}
